package com.example.domain.dto.unit;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;

/**
 * 创建单位换算规则请求DTO
 * 
 * @author Means
 * @since 2025-10-27
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
public class CreateUnitConversionRequest {
    
    /**
     * 源单位代码
     */
    @NotBlank(message = "源单位不能为空")
    private String fromUnit;
    
    /**
     * 目标单位代码
     */
    @NotBlank(message = "目标单位不能为空")
    private String toUnit;
    
    /**
     * 换算系数
     * 例如：1 KG = 2 斤，则 factor = 2.0
     */
    @NotNull(message = "换算系数不能为空")
    @DecimalMin(value = "0.0", inclusive = false, message = "换算系数必须大于0")
    private BigDecimal factor;
    
    /**
     * 是否启用（默认true）
     */
    private Boolean enabled;
}

